import {calc} from 'a-calc/es';

export default {
    data() {
        return {
            ssSubtotal: '',
            ddSubtotal: '',

            form: {

                ddChargingStandard: '',
                ddSubtotal: 0,
                ssChargingStandard: '',
                ssSubtotal: 0,
            }
        }
    },
    watch: {

        // 搭电
        'form.ddChargingStandard'() {
            this.ddSubtotal = calc(`
				${this.form.ddChargingStandard || 0}
			`)
        },

        // 送水
        'form.ssChargingStandard'() {
            this.ssSubtotal = calc(`
				${this.form.ssChargingStandard || 0}
			`)
        },
    },
    methods: {
		songshuiCancel(){
			if(!+this.ssSubtotal){
				this.form.ssCarType = ""
				this.form.ssChargingStandard = ""
				this.ssSubtotal = ""
			}
			
		},
		dadianCancel(){
			if(!+this.ddSubtotal){
				this.form.ddCarType = ""
				this.form.ddChargingStandard = ""
				this.ddSubtotal = ""
			}
		}
	},
}
